package com.zhangjq.simplefactory;

import com.zhangjq.common.CardIPay;
import com.zhangjq.common.IPay;

/**
 * Created by Administrator on 2019/3/9 0009.
 */
public class SimpleFactoryTest {
    public static void main(String[] args) {
//        //method1 普通的if判断
//        PayFactory1 payFactory1 = new PayFactory1();
//        IPay iPay = payFactory1.pay("tencentPay");
//        iPay.pay();

//        //method2  枚举类
//        PayFactory2 payFactory2 = new PayFactory2();
//        IPay iPay = payFactory2.pay(PayTypeEnum.CARDPAY);
//        iPay.pay();

        //method3  反射
        PayFactory3 payFactory3 = new PayFactory3();
        IPay iPay = payFactory3.pay(CardIPay.class);
        iPay.pay();
    }
}
